package com.usefullc.extinguisher.controller;


import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.usefullc.extinguisher.domain.FireDevice;
import com.usefullc.extinguisher.query.CheckStandardQuery;
import com.usefullc.extinguisher.query.FireDeviceQuery;
import com.usefullc.extinguisher.service.CheckStandardService;
import com.usefullc.extinguisher.service.FireDeviceService;
import com.usefullc.system.controller.WebResultBuilder;
import com.usefullc.system.domain.JobTemplate;
import com.usefullc.system.entity.WebResult;
import com.usefullc.system.query.JobTemplateQuery;
import com.usefullc.system.service.JobTemplateService;
import com.usefullc.system.service.component.ImgCodeComponent;
import com.usefullc.system.service.component.SmsComponent;
import com.usefullc.system.service.component.SystemConfigComponent;
import com.usefullc.system.validator.UsefulValid;
import com.usefullc.system.vo.TreeVo;
import com.usefullc.user.domain.User;
import com.usefullc.user.query.UserQuery;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: Sampson
 * @date: 2022-03-19 12:02
 */
@RestController
@RequestMapping(path = "/extinguisher/anonymous/")
@Api(tags = "消防匿名访问模块")
public class FireAnonymousController {

    @Autowired
    private CheckStandardService checkStandardService;

    @Autowired
    private FireDeviceService fireDeviceService;


    @ApiOperationSupport(author = "Sampson@usefullc.com")
    @ApiOperation(value = "获取树列表", response = WebResult.class)
    @GetMapping(path = "checkStandard/listTree", produces = "application/json")
    public WebResult listTree(CheckStandardQuery query) {
        query.setOrderByColumn("orderNo");
        query.setAscOrDesc("asc");
        List<TreeVo> dataList = checkStandardService.listTree(query);
        return WebResultBuilder.successResult(dataList);
    }

    @ApiOperation(value = "设备所有列表", response = WebResult.class)
    @GetMapping(path = "/fireDevice/listAll", produces = "application/json")
    public WebResult listAll(FireDeviceQuery query) {
//        query.setType(UserTypeEnum.ADMIN.getCode());
//        OnlineUser loginUser = OnlineUserManager.getLoginUser();
//        query.setTenantId(loginUser.getTenantId());
        List<FireDevice> dataList = fireDeviceService.findAll(query);
        return WebResultBuilder.successResult(dataList);
    }






}
